﻿package mortal.game.view.friendBless.view.view
{
    import Message.Public.*;
    import extend.language.*;
    import flash.events.*;
    import mortal.game.cache.*;
    import mortal.game.manager.*;
    import mortal.game.resource.*;
    import mortal.game.view.common.*;
    import mortal.game.view.friendBless.view.*;
    import mortal.game.view.friendBless.view.data.*;

    public class FriendBlessIcon extends HintBaseIcon
    {
        private static var _instance:FriendBlessIcon;

        public function FriendBlessIcon(param1:String)
        {
            super(param1);
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this.configEventListener(MouseEvent.CLICK, this.onClickHandler);
            return;
        }// end function

        private function onClickHandler(event:MouseEvent) : void
        {
            var _loc_4:FriendCongratulateData = null;
            var _loc_5:SMiniPlayer = null;
            var _loc_2:* = Cache.instance.friendBless.friendCongratulateList.slice();
            var _loc_3:int = 0;
            while (_loc_3 < _loc_2.length)
            {
                
                _loc_4 = _loc_2[_loc_3] as FriendCongratulateData;
                _loc_5 = Cache.instance.friend.getFriendById(_loc_4.miniPlayer.entityId.id);
                if (_loc_5 && !_loc_5.online)
                {
                    _loc_2.splice(_loc_3, 1);
                    _loc_3 = _loc_3 - 1;
                }
                _loc_3++;
            }
            if (_loc_2.length == 0)
            {
                MsgManager.showRollTipsMsg(Language.getString(21489));
                this.hide();
                return;
            }
            FriendBlessWin.instance.show();
            this.hide();
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            super.disposeImpl(param1);
            return;
        }// end function

        public static function get instance() : FriendBlessIcon
        {
            if (!_instance)
            {
                _instance = new FriendBlessIcon(ImagesConst.FriendZhuIcon);
            }
            return _instance;
        }// end function

    }
}
